﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            SortedList sortedList = new SortedList();
            sortedList.Add(1, "一梦江湖");
            sortedList.Add(2, "魔兽世界");
            sortedList.Add(3, "英雄联盟");
            sortedList.Add(4, "守望先锋");
            Console.WriteLine("游戏信息如下：");
            foreach (DictionaryEntry ass in sortedList)
            {
                int key = (int)ass.Key;
                string dss = ass.Value.ToString();
                Console.WriteLine("游戏编号：{0}，游戏名字：{1}",key,dss);
            }
            Console.WriteLine("请输入你要的游戏编号：");
            int id = int.Parse(Console.ReadLine());
            bool feiwi = sortedList.ContainsKey(id);
            if (feiwi)
            {
                string name = sortedList[id].ToString();
                Console.WriteLine("你要的游戏是：{0}", name);
            }
            else
            {
                Console.WriteLine("没有你要的游戏吗，傻逼");
            }
            Array<int> intarray = new Array<int>(5);
            for (int i = 0; i<5;i++)
            {
                intarray.setItem(i, i * 5);
            }
            for (int i = 0; i < 5; i++)
            {
                Console.WriteLine(intarray.getItem(i)+" ");
            }
            Console.WriteLine();
            Array<char> raary = new Array<char>(5);
            for (int i =0;i<5;i++)
            {
                raary.setItem(i, (char)(i + 98));
            }
            for (int i = 0; i < 5; i++)
            {
                Console.Write(raary.getItem(i)+" ");
            }

        }
        public class Array<T>
        {
            private T[] array;
            public Array(int size)
            {
                array = new T[size + 1];
            }
            public T getItem(int index)
            {
                return array[index];
            }
            public void setItem(int index , T value)
            {
                array[index] = value;
            }
        }

    }
}
